const userInfo = {
  namespaced: true,
  state: {
    name: "" ,
    defaultRegion: 1,
    phoneNumber: "",
    type: "",
    address: ""
  },

  getters: {
    getName: (state) => {
      return state.name;
    },
    getDefaultRegion: (state) => {
      return state.defaultRegion;
    },
    getAddress: (state) => {
      return state.address;
    },
    getPhoneNumber: (state) => {
      return state.phoneNumber;
    }
  },

  mutations: {
    SET_DATA: (state, payload) => { // 从localStorage同步
      state.name = payload.name;
      state.defaultRegion = payload.defaultRegion;
      state.phoneNumber = payload.phoneNumber;
      state.type = payload.type;
      state.address = payload.address;
    },
    clearData: (state) => {
      state.type = "",
      state.name = "",
      state.defaultRegion = 1,
      state.address = "",
      state.phoneNumber = ""
    }
  },

  actions: {
  }

};

export default userInfo;